/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.games.epkb.entityClasses;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author plebani
 */
@Embeddable
public class VirtualMachineResourcesPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "Id_VMInstance")
    private String idVMInstance;
    @Basic(optional = false)
    @Column(name = "Id_Component")
    private String idComponent;

    public VirtualMachineResourcesPK() {
    }

    public VirtualMachineResourcesPK(String idVMInstance, String idComponent) {
        this.idVMInstance = idVMInstance;
        this.idComponent = idComponent;
    }

    public String getIdVMInstance() {
        return idVMInstance;
    }

    public void setIdVMInstance(String idVMInstance) {
        this.idVMInstance = idVMInstance;
    }

    public String getIdComponent() {
        return idComponent;
    }

    public void setIdComponent(String idComponent) {
        this.idComponent = idComponent;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idVMInstance != null ? idVMInstance.hashCode() : 0);
        hash += (idComponent != null ? idComponent.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VirtualMachineResourcesPK)) {
            return false;
        }
        VirtualMachineResourcesPK other = (VirtualMachineResourcesPK) object;
        if ((this.idVMInstance == null && other.idVMInstance != null) || (this.idVMInstance != null && !this.idVMInstance.equals(other.idVMInstance))) {
            return false;
        }
        if ((this.idComponent == null && other.idComponent != null) || (this.idComponent != null && !this.idComponent.equals(other.idComponent))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "it.polimi.games.epkb.entityClasses.VirtualMachineResourcesPK[ idVMInstance=" + idVMInstance + ", idComponent=" + idComponent + " ]";
    }
    
}
